package main.Q201_300;

import java.util.Arrays;

public class Q261_270 {
    public static void main(String[] args) {
        System.out.println("Question261：");
        System.out.println("Question262：");
        System.out.println("Question263：丑数");
        System.out.println("Question264：丑数Ⅱ");
        System.out.println("Question265：");
        System.out.println("Question266：");
        System.out.println("Question267：");
        System.out.println("Question268：丢失的数字");
        System.out.println("Question269：");
        System.out.println("Question270：");
    }
}

class Question263{
    public static boolean isUgly(int n) {
        if (n <= 0) {
            return false;
        }
        int[] factors = {2, 3, 5};
        for (int factor : factors) {
            while (n % factor == 0) {
                n /= factor;
            }
        }
        return n == 1;
    }
}

class Question264{
    public int nthUglyNumber(int n) {
        int[] dp=new int[n+1];
        dp[1]=1;
        int p2=1,p3=1,p5=1;
        for (int i=2;i<n+1;i++){
            int num2=dp[p2]*2,num3=dp[p3]*3,num5=dp[p5]*5;
            dp[i]= Math.min(Math.min(num2,num3),num5);
            if (dp[i]==num2) p2++;
            if (dp[i]==num3) p3++;
            if (dp[i]==num5) p5++;
        }
        return dp[n];
    }
}

class Question268{
    public int missingNumber(int[] nums) {
        Arrays.sort(nums);//排序
        int result=-1;
        for (int i=0;i<nums.length;i++){
            if (i!=nums[i]){
                result=i;
                break;
            }
        }
        if (result==-1) result=nums.length;
        return result;
    }
}